from celery import Celery

# 配置任务数据库
broker = 'redis://127.0.0.1:6379/5'
# 配置任务结果数据库
backend = 'redis://127.0.0.1:6379/6'

app = Celery(broker=broker, backend=backend, include=['celery_task.tasks'])

# 设置时区
app.conf.timezone = 'Asia/Shanghai'
# 是否使用UTC时间
app.conf.enable_utc = False

from datetime import timedelta
from celery.schedules import crontab

app.conf.beat_schedule = {
    'pull_banner': {
        'task': 'celery_task.tasks.full_banner_cache',
        'args': (),
        # 隔多久执行一次
        'schedule': timedelta(seconds=5),   # 每隔30分钟执行一次

    }
}


